﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OpenFlashChartLib;
using OpenFlashChartLib.Charts;

namespace OpenFlashChartExample
{
    public partial class FlashData : System.Web.UI.Page
    {
        protected override void Render(HtmlTextWriter writer)
        {
            Graph g = new Graph();
            g.Title = new Title("Bar Chart");

            var bar = new BarSketch(3);
            Random random = new Random();

            bar.Fillalpha = 0.4;
            bar.Text = "Test";

            bar.Fontsize = 10;
            int max = int.MinValue;
            for (int i = 0; i < 12; i++)
            {
                int value = random.Next(i, i * 2);
                if (value > max)
                    max = value;

                var val = bar.NewValue(i.ToString(), value);
                bar.Values.Add(val);
            }

            g.AddElement(bar);
            g.OnBuildComplete();
            writer.Write(g.ToPrettyString());
        }
    }
}
